<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="/WEB-INF/tld/pager-taglib.tld" prefix="pg"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'user_list.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    This is my JSP page. <a href="${pageContext.request.contextPath}/example/user_add.jsp">add</a><p>
    <table>
    <tr>
    <td>序号</td>
    <td>ID</td>
    <td>姓名</td>
    <td>生日</td>
    <td>性别</td>
    <td>注册日期</td>
    <td>操作</td>
    </tr>
    <s:subset id="mySubset" source="list" count="20" start="0">
    <s:iterator  status="stuts" var="?#this.user_id=='yunxiangfu'">
    <tr>
    <td>
    <s:if test="#stuts.odd==true"><font color="red"><s:property value="pager.number-#stuts.index"/></font></s:if>
    <s:else><s:property value="pager.number-#stuts.index"/></s:else>
    </td>
    <td><s:property value="user_id"/></td>
    <td><s:property value="name"/></td>
    <td><s:date name="birthday" format="yyyy-MM-dd"/></td>
    <td>
    <s:if test="sex=='0'">none</s:if>
    <s:elseif test="sex==1">man</s:elseif>
    <s:elseif test="sex==2">woman</s:elseif>
    <s:else>none</s:else>
    </td>
    <td><s:date name="registe_date" format="yyyy-MM-dd"/></td>
    <td>
    <a href="${pageContext.request.contextPath}/viewUser.action?userNo=<s:property value="user_no"/>">view</a>
    <a href="${pageContext.request.contextPath}/modifyUser.action?userNo=<s:property value="user_no"/>">modify</a>
    </td>
    </tr>
    </s:iterator>
    </s:subset>
    </table>
	<!---------page start----------->
     <pg:pager items="${pager.items}" maxPageItems="${pager.maxPageItems}"
	  maxIndexPages="${pager.maxIndexPages}" isOffset="true"
	  index="center" url="listUser.action"
	  export="offset, currentPageNumber=pageNumber" scope="request">
	<pg:first>
		<a href="${attr.pageUrl}"><<</a>&nbsp;
	</pg:first>
	<pg:prev ifnull="true">
	 <s:if test="#attr.pageUrl==null">
	 	prev
	 </s:if>
	 <s:else>
	 <a href="${attr.pageUrl}">prev</a>
	 </s:else>
	</pg:prev>																												
	<pg:pages>
    <s:if test="#attr.pageNumber==#attr.currentPageNumber">
    <s:property value="#attr.pageNumber"/>
    </s:if>
    <s:else>
    <a href="${attr.pageUrl}"><s:property value="#attr.pageNumber"/></a>
    </s:else>
	</pg:pages>
	<pg:next ifnull="true">
	  <s:if test="#attr.pageUrl==null">
	  next
	  </s:if>
	  <s:else>
	  <a href="${attr.pageUrl}">next</a>
	  </s:else>
	</pg:next>															
	<pg:last>
	<a href="${attr.pageUrl}">>></a>
	</pg:last>
	</pg:pager>	   
	<!---------page end----------->
  </body>
  
</html>
